// VueRouter的API也是按需导入
import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import About from '../views/About.vue'

// 配置路由映射：路径和组件的对应关系
const routes = [
  {
    path: '/',
    component: Home
  },
  {
    path: '/about',
    component: About
  }
]

// Vue2风格
// const router = new VueRouter({
//   mode: 'hash', // history
//   routes: routes
// })

// Vue3风格
const router = createRouter({
  // 表示采用hash模式的路由
  history: createWebHashHistory(), // hash
  // history: createWebHistory(), // history
  routes
})

export default router
